home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / Progress.h < prev    next >
C/C++ Source or Header  |  1992-04-27  |  931b  |  55 lines

  1. #ifndef Progress_First
  2. #ifdef __GNUG__
  3. //pragma once
  4. #pragma interface
  5. #endif
  6. #define Progress_First
  7.  
  8. #include "Object.h"
  9.  
  10. //---- Progress ----------------------------------------------------------------
  11.  
  12. class Progress : public Object {
  13. public:
  14.     MetaDef(Progress);
  15.     Progress();
  16.  
  17.     inline void SetMax(int mx);
  18.     inline bool Tick(int curr);
  19.     inline bool Inc(int inc);
  20.     void Start(char *message, int mx);
  21.     void Stop();
  22.     void Abort();
  23.     virtual void SetMessage(char *message);
  24.  
  25. protected:
  26.     virtual void SetUp();
  27.     virtual bool SetVal();
  28.     virtual void Abort(bool skiptoend);
  29.     
  30.     int curr, max;
  31.     bool timeout;
  32. };
  33.  
  34. extern Progress *gProgress;
  35.  
  36. inline void Progress::SetMax(int mx)
  37. {
  38.     max= mx;
  39. }
  40.  
  41. inline bool Progress::Tick(int val)
  42. {
  43.     curr= val;
  44.     return timeout ? SetVal() : FALSE;
  45. }
  46.  
  47. inline bool Progress::Inc(int inc)
  48. {
  49.     curr+= inc;
  50.     return timeout ? SetVal() : FALSE;
  51. }
  52.  
  53. #endif
  54.  
  55.